package com.wzy.portfolio.model;


public class MacdResult {

    private String date;  // 使用 String 类型的日期
    private double dif;
    private double dea;
    private double macd;

    // 构造方法中格式化
    public MacdResult(String date, double dif, double dea, double macd) {
        this.date = date;
        this.dif = Double.parseDouble(String.format("%.2f", dif));
        this.dea = Double.parseDouble(String.format("%.2f", dea));
        this.macd = Double.parseDouble(String.format("%.2f", macd));
    }

    // Getter 和 Setter 方法
    public String getDate() {
        return date;
    }

    public double getDif() {
        return dif;
    }

    public double getDea() {
        return dea;
    }

    public double getMacd() {
        return macd;
    }

    // 设置值时也可以格式化
    public void setDif(double dif) {
        this.dif = Double.parseDouble(String.format("%.2f", dif));
    }

    public void setDea(double dea) {
        this.dea = Double.parseDouble(String.format("%.2f", dea));
    }

    public void setMacd(double macd) {
        this.macd = Double.parseDouble(String.format("%.2f", macd));
    }

}
